package ${package.ServiceImpl};

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {

    @Override
    public List<${entity}> list(${entity} entity) {
    QueryWrapper<${entity}> wrapper = createWrapper(entity);
        return baseMapper.selectList(wrapper);
    }

    @Override
    public PageInfo pg(${entity} entity, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<${entity}> list = list(entity);
        return new PageInfo<>(list);
    }

    private QueryWrapper<${entity}> createWrapper(${entity} entity) {
        QueryWrapper<${entity}> wrapper = new QueryWrapper<>();
        if(null == entity) {
           return wrapper;
        }
        return wrapper;
    }

}

